#!/usr/bin/env python3

import multiprocessing as mp
import os
import time
import random

def Run(v, *args):
    print("child pid = ", os.getpid(), ", Run args: ", args)
    for i in range(10):
        v[i] = random.randint(10, 99)
    time.sleep(5)
    print("child exit....")


def show(v, title=""):
    print(title, end="")
    for i in range(10):
        print(v[i], " ", end='')
    print()

def main():
    print("main pid = ", os.getpid())

    v = mp.Array('i', 10)
    show(v, "Array Init: ")

    p = mp.Process(target=Run, args=(v, 123, "kyo"))
    p.start()
    time.sleep(2)
    show(v, "child Array data: ")
    p.join()

if __name__ == "__main__":
    main()
